<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#id1{
				width: 200px;
				height: 200px;
				background-color: blue;
			}
		</style>
	</head>
	<body>
		<div id="id1">
			
		</div>
		<button type="button" id="bt1" onclick="btclick1();">添加监听器</button>
		<button type="button"id="bt2" onclick="btclick2();">清除监听器</button>
	</body>
	<script type="text/javascript">
		//4.实现DIV移动事件，采用监听器方式操作，可实现添加和清除监听器功能。
		function mousemovediv(){
			console.log('你在div中移动')
		}
		function btclick1(){
		document.getElementById('id1').addEventListener('mousemove',mousemovediv);	
		}
		function btclick2(){
		document.getElementById('id1').removeEventListener('mousemove',mousemovediv);	
		}
	
	</script>
</html>
